<?php
namespace app\api\controller;

use app\api\model\ClubModel;
use think\Controller;

class Club  extends  Controller
{
    function  clublist(){
        $model=new  ClubModel();
        $result = $model->clublist();
        return json($result);

    }
    function clubdetail() {
        $clubid = input('get.clubid');
        $model = new ClubModel();
        $result = $model->clubdetail($clubid);
        if ($result) {
            return json($result);
        }else {
            return  json(['id'=>0]);
        }

    }

    function collect() {
        $userid = input('get.userid');
        $clubid = input('get.clubid');

        $model = new ClubModel();
        $result = $model->collect($userid, $clubid);
        return json($result);
    }

    function isCollect() {
        $userid = input('get.userid');
        $clubid = input('get.clubid');

        $model = new ClubModel();
        $result = $model->isCollect($userid, $clubid);
        return json($result);
    }

    function getLesson() {
        $clubid = input('clubid');
        $model = new ClubModel();
        $res = $model->getlesson($clubid);
        return json($res);
    }

    public function collectClubList(){
        $userid = input('get.userid');
        $model = new ClubModel();
        $result = $model->collectClubList($userid);
        return json($result);
    }

}